﻿@model PagedList.IPagedList<DealKhuyenMaiV2.com.Models.StatusOrder>
@helper Truncate(string
input, int length)
    {
        if (input.Length <= length)
        {
    @input
        }
        else
        {
    @input.Substring(0, length)<text>...</text>
        }
}
<div id="ListProduct">
    <table class="list">
        <thead>
            <tr>
                <td class="left">
                    NameStatus
                </td>
                <td class="left">
                    Description
                </td>
                <td class="right">
                </td>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            <tr>
                <td class="left">
                    @Html.DisplayFor(modelItem => item.NameStatus)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Description)
                </td>
                <td class="right">
                    @Html.ActionLink("Edit", "Edit", new { id = item.IDStatus }) |                
                   @Ajax.ActionLink("Delete", "Delete", "StatusOrder", new { page = Model.PageNumber, id = item.IDStatus }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListStatusOrders", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
                </td>
            </tr>
        }
    </table>
    <div>
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
        of @Model.PageCount
        @if (Model.HasPreviousPage)
        {
               
            @Ajax.ActionLink("<<", ViewBag.Methol as string, "StatusOrder", new { page = 1, KeyWord = ViewBag.KeyWord as string, Display = ViewBag.Display as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListStatusOrders", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
            @Html.Raw(" ");
            @Html.Raw(" ");
            @Ajax.ActionLink("< Prev", ViewBag.Methol as string, "StatusOrder", new { page = Model.PageNumber - 1, KeyWord = ViewBag.KeyWord as string, Display = ViewBag.Display as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListStatusOrders", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
        }
        else
        {
            @:<<
                @Html.Raw(" ");
            @:< Prev
                                                                                    }
        @if (Model.HasNextPage)
        {
            @Ajax.ActionLink("Next >", ViewBag.Methol as string, "StatusOrder", new { page = Model.PageNumber + 1, KeyWord = ViewBag.KeyWord as string, Display = ViewBag.Display as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListStatusOrders", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
            @Html.Raw(" ");
            @Ajax.ActionLink(">>", ViewBag.Methol as string, "StatusOrder", new { page = Model.PageCount, KeyWord = ViewBag.KeyWord as string, Display = ViewBag.Display as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListStatusOrders", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
        }
        else
        {
            @:Next >
                @Html.Raw(" ")
            @:>>
                                                                                    }
    </div>
</div>
